package com.bw.controller;

import com.bw.entity.User;
import com.bw.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class ListController {

    @Autowired
    UserMapper userMapper;

    @RequestMapping("/list.do")
    public String list(Model model){

      List<User> list =   userMapper.selectAll();

        model.addAttribute("list",list);  // 给jsp页面赋值
        return "list";
    }
}
